<?php
declare (strict_types=1);

namespace app\command;

use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;

class Create_enums extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('create_enums')
            ->setDescription('the create_enums command');
    }

    protected function execute(Input $input, Output $output)
    {
        $src = root_path() . "extend/core_enums.php";
        $dst = root_path() . "public/static/admin_scripts/core_enums.js";
        $content = json_encode(include($src));
        file_put_contents($dst, "var core_enums={$content};");
        // 指令输出
        $output->writeln('success');
    }
}
